Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-helper-replace-supers

Package Overview
Dependencies
Maintainers
6
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-helper-replace-supers

Helper function to replace supers

  • 6.24.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
increased by12.05%
Maintainers
6
Weekly downloads
 
Created

What is babel-helper-replace-supers?

The babel-helper-replace-supers npm package is a utility within the Babel ecosystem that helps in transforming ES2015 (ES6) super calls into a form that can be understood by environments that do not support them natively. This package is particularly useful when working with classes and inheritance in JavaScript, where the 'super' keyword is used.

What are babel-helper-replace-supers's main functionalities?

Transformation of super calls in methods

This feature allows the transformation of super calls within methods of a class. The code sample shows a class where both the constructor and a method use 'super' to call their respective counterparts in the parent class.

class Child extends Parent {
  constructor() {
    super();
    console.log('Child constructor');
  }
  myMethod() {
    super.myMethod();
    console.log('Additional code in child method');
  }
}

Handling of super calls in constructors

This feature specifically handles the transformation of super calls within constructors, ensuring that the parent class's constructor is called before the child class's constructor logic is executed.

class Child extends Parent {
  constructor() {
    super();
    this.state = { key: 'value' };
    console.log('Child constructor');
  }
}

Other packages similar to babel-helper-replace-supers

FAQs

Package last updated on 07 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc